package com.xia.im.controller.h5;

import com.xia.im.common.result.Result;
import com.xia.im.common.result.ResultUtils;
import com.xia.im.entity.SysUser;
import com.xia.im.entity.resp.LoginVO;
import com.xia.im.service.SysUserService;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.Valid;

@RequestMapping("/h5/login")
@RestController
public class LoginH5Controller {

    @Resource
    private SysUserService sysUserService;

    @PostMapping("/login")
    @Operation(summary = "用户登录", description = "用户登录")
    public Result<LoginVO> login(@Valid @RequestBody SysUser sysUser) {
        LoginVO login = sysUserService.login(sysUser);
        return ResultUtils.success(login);
    }
}
